package com.ywu.bpmn.form.standard.api;

import com.ywu.bpmn.form.service.dto.YwuFormInterfaceDto;
import com.ywu.bpmn.form.service.dto.YwuFormInterfaceVersionDto;
import com.ywu.bpmn.form.standard.service.YwuFormInterfaceStandardService;
import com.ywu.common.result.CommonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ClassName YwuFormInterfaceApi
 * @Description TODO
 * @Author GroundDemo
 * @Date 2025/4/21 13:00
 * @Version 1.0
 **/
@RestController
@RequestMapping("/ywu/bpmn/form/interface")
public class YwuFormInterfaceApi {

    @Autowired
    private YwuFormInterfaceStandardService service;

    /**
    * @Author GroundDemo
    * @Description 创建表单外部接口
    * @Date 13:02 2025/4/21
    * @Param [dto]
    * @return com.ywu.common.result.CommonResult<java.lang.Object>
    **/
    @PostMapping("/create.form.interface.info")
    public CommonResult<Object> createInterface(@RequestBody YwuFormInterfaceDto dto) {
        return service.createInterface(dto);
    }

    /**
    * @Author GroundDemo
    * @Description 修改表单外部接口
    * @Date 13:02 2025/4/21
    * @Param [dto]
    * @return com.ywu.common.result.CommonResult<java.lang.Object>
    **/
    @PostMapping("/update.form.interface.info")
    public CommonResult<Object> updateInterface(@RequestBody YwuFormInterfaceDto dto) {
        return service.updateInterface(dto);
    }

    /**
    * @Author GroundDemo
    * @Description 删除表单外部接口
    * @Date 13:03 2025/4/21
    * @Param [dto]
    * @return com.ywu.common.result.CommonResult<java.lang.Object>
    **/
    @PostMapping("/delete.form.interface.info")
    public CommonResult<Object> deleteInterface(@RequestBody YwuFormInterfaceDto dto) {
        return service.deleteInterface(dto);
    }

    /**
    * @Author GroundDemo
    * @Description 分页查询表单外部接口
    * @Date 13:04 2025/4/21
    * @Param [dto]
    * @return com.ywu.common.result.CommonResult<java.lang.Object>
    **/
    @PostMapping("/query.form.interface.page.list.info")
    public CommonResult<Object> queryInterfacePageList(@RequestBody YwuFormInterfaceDto dto) {
        return service.queryInterfacePageList(dto);
    }

    /**
    * @Author GroundDemo
    * @Description 发布表单外部接口
    * @Date 13:04 2025/4/21
    * @Param [dto]
    * @return com.ywu.common.result.CommonResult<java.lang.Object>
    **/
    @PostMapping("/publish.form.interface.info")
    public CommonResult<Object> publishInterface(@RequestBody YwuFormInterfaceDto dto) {
        return service.publishInterface(dto);
    }

    /**
    * @Author GroundDemo
    * @Description 查询历史版本列表
    * @Date 13:05 2025/4/21
    * @Param [dto]
    * @return com.ywu.common.result.CommonResult<java.lang.Object>
    **/
    @PostMapping("/query.form.interface.version.list.info")
    public CommonResult<Object> queryVersionList(@RequestBody YwuFormInterfaceDto dto) {
        return service.queryVersionList(dto);
    }

    /**
    * @Author GroundDemo
    * @Description 删除草稿版本
    * @Date 13:06 2025/4/21
    * @Param [dto]
    * @return com.ywu.common.result.CommonResult<java.lang.Object>
    **/
    @PostMapping("/delete.form.interface.version.info")
    public CommonResult<Object> deleteVersion(@RequestBody YwuFormInterfaceVersionDto dto) {
        return service.deleteVersion(dto);
    }

    /**
    * @Author GroundDemo
    * @Description 回退历史版本
    * @Date 13:06 2025/4/21
    * @Param [dto]
    * @return com.ywu.common.result.CommonResult<java.lang.Object>
    **/
    @PostMapping("/back.form.interface.version.info")
    public CommonResult<Object> backVersion(@RequestBody YwuFormInterfaceVersionDto dto) {
        return service.backVersion(dto);
    }

    /**
    * @Author GroundDemo
    * @Description 执行外部接口
    * @Date 17:44 2025/4/21
    * @Param [dto]
    * @return com.ywu.common.result.CommonResult<java.lang.Object>
    **/
    @PostMapping("/exec.form.interface.version.info")
    public CommonResult<Object> execInterfaceByVersion(@RequestBody YwuFormInterfaceVersionDto dto) {
        return service.execInterfaceByVersion(dto);
    }

    /**
    * @Author GroundDemo
    * @Description 执行外部接口
    * @Date 17:44 2025/4/21
    * @Param [dto]
    * @return com.ywu.common.result.CommonResult<java.lang.Object>
    **/
    @PostMapping("/exec.form.interface.by.code")
    public CommonResult<Object> execInterfaceByCode(@RequestBody YwuFormInterfaceVersionDto dto) {
        return service.execInterfaceByCode(dto);
    }

}
